package com.yic.module.device.dal.mysql.maintenanceDeviceEntry;

import java.util.*;

import com.yic.framework.common.pojo.PageResult;
import com.yic.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yic.framework.mybatis.core.mapper.BaseMapperX;
import com.yic.module.device.dal.dataobject.maintenanceDeviceEntry.MaintenanceDeviceEntryDO;
import org.apache.ibatis.annotations.Mapper;
import com.yic.module.device.controller.admin.maintenanceDeviceEntry.vo.*;

/**
 * 设备与保养项关联 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface MaintenanceDeviceEntryMapper extends BaseMapperX<MaintenanceDeviceEntryDO> {

    default PageResult<MaintenanceDeviceEntryDO> selectPage(MaintenanceDeviceEntryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaintenanceDeviceEntryDO>()
                .eqIfPresent(MaintenanceDeviceEntryDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(MaintenanceDeviceEntryDO::getEntryId, reqVO.getEntryId())
                .betweenIfPresent(MaintenanceDeviceEntryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MaintenanceDeviceEntryDO::getId));
    }

    default List<MaintenanceDeviceEntryDO> selectList(MaintenanceDeviceEntryExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MaintenanceDeviceEntryDO>()
                .eqIfPresent(MaintenanceDeviceEntryDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(MaintenanceDeviceEntryDO::getEntryId, reqVO.getEntryId())
                .betweenIfPresent(MaintenanceDeviceEntryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MaintenanceDeviceEntryDO::getId));
    }

}
